<template>
  <aside :class="['aui-sidebar', `aui-sidebar--${$store.state.sidebarLayoutSkin}`]">
    <div class="aui-sidebar__inner">
      <el-menu v-if="$store.state.sidebarMenuList[$store.state.sidebarMenuIndex].show && $store.state.sidebarMenuList[$store.state.sidebarMenuIndex] && $store.state.sidebarMenuList[$store.state.sidebarMenuIndex].children"
        :default-active="$store.state.sidebarMenuActiveName"
        :collapse="isCollapse"
        :unique-opened="true"
        :collapseTransition="false"
        class="aui-sidebar__menu">
        <sub-menu v-for="menu in $store.state.sidebarMenuList[$store.state.sidebarMenuIndex].children" :key="menu.id" :menu="menu" />
      </el-menu>
    </div>
  </aside>
</template>

<script>
import SubMenu from './main-sidebar-sub-menu'
export default {
    props: ['isCollapse'],
  data () {
    return {
      farm_type: ''
    }
  },
  components: {
    SubMenu
  },
  created () {
    this.$store.state.sidebarMenuList = window.SITE_CONFIG['menuList']
    this.farm_type = window.SITE_CONFIG['farm'].type
    if (this.farm_type.indexOf('繁育') === -1) {
      this.$store.state.sidebarMenuList[1].children.splice(0, 1)
    }
    if (this.farm_type.indexOf('育肥') === -1) {
      this.$store.state.sidebarMenuList[1].children.splice(1, 1)
    }
  }
}
</script>
